Placing objects with an offset from the surface they're placed on

My player can place objects by clicking on surfaces. I have added an offset for when this is done to floors:

new Vector3(hit.point.x, hit.point.y + (hitObject.GetComponent<Renderer>().bounds.size.y / 2), hit.point.z)

However, this only works on flat floors. Walls and other surfaces are a problem. Even cube objects tend to clip and fall through when this is done with walls or some slopes. They can also stick in ceilings.

I don’t want to write special code for ceilings and walls, so is there a way to always determine which direction I need to offset an object by - just by knowing its bounds and the surface clicked?

public GameObject prefab;

	void Update()
	{
        if (Input.GetMouseButtonDown(0))
            if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out RaycastHit hit))
				 Instantiate(prefab,hit.point+hit.normal*prefab.GetComponent<Renderer>().bounds.size.y/2,Quaternion.FromToRotation(Vector3.up,hit.normal));
	}