Thank you so much for the kind comments! I am working on getting a fix implemented so you can't box the player in. However, I'm fairly new to programming so I'm having trouble figuring out the best way to do this!
I'm no programming maestro either, but given that you're using a tilemap-based system, before placing a block, you could run the preexisting pathfinding algorithm (or one from the Asset store) with the tile added in code (w/o actually rendering the tile) and if there is no path, then you can prevent the tile from being placed.
If you want a simpler method, you're already doing a check after the block has been placed, so if that check returns false, simply undo the placement. I might also consider doing tile-based movement (from tile to tile) as this would make pathfinding a lot easier for you. Just my two cents =)